import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ButtonPanelA extends JPanel {

	//public BufferedImage image;
	public Image i;
	public JLabel label;
	private Output o;
	public ButtonPanelA(String arg1, int arg2, Output arg3) {
		o = arg3;
		this.setBackground(Color.white);
		this.setBorder(BorderFactory.createLineBorder(Color.black, 1));
		this.setPreferredSize(new Dimension(arg2, 70));
		this.setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		
		i = new ImageIcon("metal.gif").getImage();

		label = new JLabel(arg1);
		label.setFont(new Font("Arial", Font.BOLD, 13));
		this.add(label, gbc);
		
		this.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseEntered(java.awt.event.MouseEvent evt) {
				i = new ImageIcon("metalhover.gif").getImage();
				repaint();
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				i = new ImageIcon("metal.gif").getImage();
				repaint();
			}
			public void mouseClicked(java.awt.event.MouseEvent evt){	
				o.act(label.getText());
			}
		});
		
	}
	public void setText(String arg1){
		label.setText(arg1);
	}

	public void paintComponent(Graphics g) {
		g.drawImage(i, 0, 0, this.getWidth(), this.getHeight(), null);
	}
}
